#include "define.h"   
#include "variable.h"   
#include "I2C.h"   
#include "osddisplay.h"   
#include "key.h"   
#include "IEBus.h"   
#include "memory.h"   
#include "video.h"   
   
extern void Send_Char(uchar c);   
   
void Rev_Process(uchar c);   
void Mode_Process(uchar c);   
   
   
   
/*{0x17,0xA0,0x87,0xA4,0x5C,0x6E,0x63,0x83,0x01};*/   
   
void Variable_Init(void)   
{   
  SysMenuDisplayFlg=0x00;   
  WindowDispFlag=NO_WINDOW;   
  SysWindowsOff;   
  SysMenuCnt=0;   
  VideoMenuCnt=0;   
}   
void Video_Init(void)   
{   
   MemoryInit_Check();   
/*    
   SysMenuBright=0x1f;  
   SysMenuColor=0xA5;  
   SysMenuCont=0x82;  
   SysMenuPic=0x5a;  
   SysMenuTint=0x9D;  
   SysMenuCom=0x81;  
   SysMenuSubr=0x6B;  
   SysMenuSubb=0x60;  
*/      
    
   Pwm_Process(CTRADDR,  0x7C);//0x7c   
   Pwm_Process(BRIGHTADDR,SysMenuBright);//+VideoMenuBright);   
   Pwm_Process(COLORADDR, SysMenuColor);//+VideoMenuColor);   
   Pwm_Process(CONTADDR,  SysMenuCont);//+VideoMenuCont);   
   Pwm_Process(PICADDR,   SysMenuPic);   
   Pwm_Process(TINTADDR,  SysMenuTint);   
   Pwm_Process(COMADDR,   SysMenuCom);   
   Pwm_Process(SUBRADDR,  SysMenuSubr);   
   Pwm_Process(SUBBADDR,  SysMenuSubb);     
      
   Rev_Process(2);   
   Mode_Process(0);   
      
   Osd_Init();   
   Logo_Disp();      
      
   //Yc_Process(0x4f,0x00,0xd0);   
   //Yc_Process(0x00,0x00,0x00);   
}   
   
   
void Pwm_On(void)   
{   
  ICR1 =150;//210;//0xD5;//8M/8/D5=4.7K   
  OCR1A=67;//0x6A;   
  TCCR1A=0x82;//0x82;   
  //TCCR1B=0x1A;//clk/8    
  TCCR1B=0x1B;//clk/64    
  //TCCR1B=0x1C;//clk/256    
}   
void Pwm_Off(void)   
{   
  TCCR1A=0x82;//0x82;   
  TCCR1B=0x18;//clk/8    
}   
void SysOn_Init(void)//开机初始化   
{     
  Variable_Init();   
  I2c_Init();   
  DECODE_High;   
  VGHGL_High;//+-   
  NmDelay(200);   
  Video_Init();   
  NmDelay(200);   
  //Pwm_On();   
  NmDelay(100);   
  HIGHV_High;//高压     
     
  NmDelay(100);     
     
  if(!ConnectVal)   
  {    
    Osd_Clear();   
    Windows_Close();   
  }   
     
  Rev_Process(VideoMenuRev);   
  Mode_Process(VideoMenuMode);   
  LED1_High;   
  LED2_High;   
     
  INT1_Enable;   
}   
   
void SysOff_Init(void)//关机初始化   
{   
  INT1_Disable;     
  HIGHV_Low;//高压   
  VGHGL_Low;//+-   
  if(!ConnectVal)//未联机   
     Memory_Save(0);   
  //Memory_Save(1);   
  //Pwm_Off();   
  NmDelay(200);   
  DECODE_Low;   
  ConnectNo;   
  LED1_Low;   
  LED2_Low;   
}   
   
void Rev_Process(uchar c)   
{   
  switch(c)   
   {   
     case 0:   
     case 2:UD_Low;LR_High; break;   
     case 1:UD_High;LR_Low;break;        
     case 3:UD_High;LR_High;break;   
     case 4:UD_Low;LR_Low;break;   
     default:break;   
    }   
}   
void Mode_Process(uchar c)   
{   
  if(c==0)   
    MODE_Low;   
  else   
    MODE_High;   
}   
void Ctr_Process(void)   
{   
   if(WindowDispFlag==VIDEO_WINDOW)//user setting   
      switch(VideoMenuCnt)   
        {   
          case NUM_BRIGHT: Pwm_Process(BRIGHTADDR,SysMenuBright+VideoMenuBright);break;   
          case NUM_COLOR:  Pwm_Process(COLORADDR,SysMenuColor+VideoMenuColor);  break;   
          case NUM_CONT:   Pwm_Process(CONTADDR,SysMenuCont+VideoMenuCont);    break;   
          case NUM_REV:    Rev_Process(VideoMenuRev);              break;   
          case NUM_MODE:   Mode_Process(VideoMenuMode);            break;     
          default:break;   
         }   
      
   else if(SysWindowsVal)//sytem setting   
      switch(SysMenuCnt)   
        {   
          case  NUM_BRIGHT: Pwm_Process(BRIGHTADDR,SysMenuBright);break;   
          case  NUM_COLOR:  Pwm_Process(COLORADDR, SysMenuColor); break;   
          case  NUM_CONT:   Pwm_Process(CONTADDR,  SysMenuCont);  break;   
          case  NUM_PIC:    Pwm_Process(PICADDR,   SysMenuPic);   break;   
          case  NUM_TINT:   Pwm_Process(TINTADDR,  SysMenuTint);  break;    
          case  NUM_COM:    Pwm_Process(COMADDR,   SysMenuCom);   break;    
          case  NUM_SUBR:   Pwm_Process(SUBRADDR,  SysMenuSubr);  break;    
          case  NUM_SUBB:   Pwm_Process(SUBBADDR,  SysMenuSubb);  break;    
          default:break;   
         }   
}   
void Disp_Process(void)   
{         
   if(SysWindowsVal)//System   
     {   
       Sysdata_Updata();   
     }     
   else if(WindowDispFlag==VIDEO_WINDOW)//user setting   
     {   
       Videodata_Updata();   
     }   
}   
   
void KeyPower_Process(void)   
{     
   if(PowVal)//如果开机   
    {         
      SysOff_Init();   
      PowOff;//关机   
     }   
   else   
    {   
      SysOn_Init();   
      PowOn;   
     }   
}   
void KeySet_Process(void)   
{   
   if(WindowDispFlag==VIDEO_WINDOW)   
     {    
       WindowDispFlag=NO_WINDOW;   
       Windows_Close();   
       SysWindowsOff;   
      }   
   else   
     {   
       WindowDispFlag=VIDEO_WINDOW;   
       SysWindowsOff;   
       VideoSet_Windows();   
       //SoundSet_Windows();   
       //UsrSet_Windows();   
       //RadioFreCH++;   
       //if(RadioFreCH>8)   
       //   RadioFreCH=0;   
       //RadioDisp_Windwos();   
       //DvcDisp_Windows();   
      }     
}   
void KeyVolInc_Process(void)//UP   
{   
   if(SysMenuDisplayFlg==0||SysMenuDisplayFlg==1)   
      SysMenuDisplayFlg=1;   
   else   
      SysMenuDisplayFlg=0xff;   
      
   if(WindowDispFlag==VIDEO_WINDOW)//if video set close return    
    {   
      if(VideoMenuCnt>0)   
        VideoMenuCnt--;   
      else   
        VideoMenuCnt=VIDEOMENU_NUM-1;   
     }   
   else if(SysWindowsVal)//system setting   
    {   
      if(SysMenuCnt>0)   
        SysMenuCnt--;   
      else   
        SysMenuCnt=SYSMENU_NUM-1;   
     }   
   Disp_Process();   
}   
void KeyVolDec_Process(void)//DOWN   
{   
      if(SysMenuDisplayFlg==1||SysMenuDisplayFlg==2)   
      SysMenuDisplayFlg=2;   
   else   
      SysMenuDisplayFlg=0xff;   
     
   if(WindowDispFlag==VIDEO_WINDOW)//if video set close return    
    {   
      VideoMenuCnt++;   
      if(VideoMenuCnt>=VIDEOMENU_NUM)   
         VideoMenuCnt=0;   
      }   
   else if(SysWindowsVal)//system setting   
    {   
      SysMenuCnt++;   
      if(SysMenuCnt>=SYSMENU_NUM)   
         SysMenuCnt=0;   
     }    
   Disp_Process();   
}   
   
void KeyPrev_Process(void)//LEFT   
{   
   if(SysMenuDisplayFlg==3)   
    {    
      SysMenuDisplayFlg=0xff;   
      SysWindowsOn;   
      WindowDispFlag=NO_WINDOW;   
      Sysdata_Updata();   
      return;   
     }   
   else   
      SysMenuDisplayFlg=0xff;   
      
   if(WindowDispFlag==VIDEO_WINDOW)//if video set close return    
     switch(VideoMenuCnt)   
       {   
         case NUM_BRIGHT:  if(VideoMenuBright>0) VideoMenuBright--;break;   
         case NUM_COLOR:   if(VideoMenuColor>0)  VideoMenuColor--; break;   
         case NUM_CONT:    if(VideoMenuCont>0)   VideoMenuCont--;  break;   
         case NUM_REV:     if(VideoMenuRev>1)    VideoMenuRev--;   break;   
         case NUM_MODE:    if(VideoMenuMode>0)   VideoMenuMode--;  break;   
         default: break;   
       }   
   else if(SysWindowsVal)//system setting   
     switch(SysMenuCnt)   
       {   
         case NUM_BRIGHT :  if(SysMenuBright>0)   SysMenuBright--;break;   
         case NUM_COLOR:    if(SysMenuColor>0)    SysMenuColor--; break;   
         case NUM_CONT:     if(SysMenuCont>0)     SysMenuCont--;  break;   
         case NUM_PIC:      if(SysMenuPic>0)      SysMenuPic--;   break;   
         case NUM_TINT:     if(SysMenuTint>0)     SysMenuTint--;  break;   
         case NUM_COM:      if(SysMenuCom>0)      SysMenuCom--;  break;   
         case NUM_SUBR:     if(SysMenuSubr>0)     SysMenuSubr--;  break;   
         case NUM_SUBB:     if(SysMenuSubb>0)     SysMenuSubb--;  break;   
         default: break;   
        }   
   Disp_Process();   
   Ctr_Process();   
}   
void KeyNext_Process(void)//RIGHT   
{   
   if(SysMenuDisplayFlg==2||SysMenuDisplayFlg==3)   
      SysMenuDisplayFlg=3;   
   else   
      SysMenuDisplayFlg=0xff;     
      
   if(WindowDispFlag==VIDEO_WINDOW)//if video set close return    
     switch(VideoMenuCnt)   
      {   
       case NUM_BRIGHT: VideoMenuBright++;if(VideoMenuBright>16) VideoMenuBright=16;break;   
       case NUM_COLOR:  VideoMenuColor++; if(VideoMenuColor>16)  VideoMenuColor=16; break;   
       case NUM_CONT:   VideoMenuCont++;  if(VideoMenuCont>16)   VideoMenuCont=16;  break;   
       case NUM_REV:    VideoMenuRev++;   if(VideoMenuRev>4)     VideoMenuRev=4;    break;   
       case NUM_MODE:   VideoMenuMode++;  if(VideoMenuMode>1)    VideoMenuMode=1;   break;   
       default:break;   
       }   
   else if(SysWindowsVal)//system setting   
     switch(SysMenuCnt)   
       {   
         case NUM_BRIGHT:  if(SysMenuBright<0xFF)   SysMenuBright++;break;   
         case NUM_COLOR:   if(SysMenuColor<0xFF)    SysMenuColor++; break;   
         case NUM_CONT:    if(SysMenuCont<0xFF)     SysMenuCont++;  break;   
         case NUM_PIC:     if(SysMenuPic<0xFF)      SysMenuPic++;   break;   
         case NUM_TINT:    if(SysMenuTint<0xFF)     SysMenuTint++;  break;   
         case NUM_COM:     if(SysMenuCom<0xFF)      SysMenuCom++;  break;   
         case NUM_SUBR:    if(SysMenuSubr<0xFF)     SysMenuSubr++;  break;   
         case NUM_SUBB:    if(SysMenuSubb<0xFF)     SysMenuSubb++;  break;   
         default: break;   
        }   
   Disp_Process();   
   Ctr_Process();   
}   
   
void SendDataToBus(uchar Cmd,uchar Val,uchar LongFlag)   
{   
   IEBus_TBroadcast=0x80;//0x80;   
   IEBus_THAddr=IEBus_MASTERADDR>>4;   
   IEBus_TLAddr=(uchar)(IEBus_MASTERADDR<<4);      
   IEBus_TLength=3;   
   IEBus_TData0=Cmd;//CMD_KEY;//Cmd_KEY   
   IEBus_TData1=Val;//KeyPrevious;//KEY   
   if(LongFlag)//(KeyLongFlagVal)   
      IEBus_TData2=0x01;//Val      
   else   
      IEBus_TData2=0x00;//Val      
   IEBus_SendData(IEBus_TxBuf);      
}   
   
/*********************************************  
      
   按键处理方式：当面板与外界（主控制板）联机时，收集到的按键直接传输给总线  
                 当面板没有与外界联机，单独使用时，响应按键，但只对面板的video调节的按键起作用  
  
*********************************************/   
   
void Key_Process(void)   
{   
   if(!ConnectVal)//if not connect mainboard   
   {   
     if((KeyPrevious!=KEYPOWER)&&(!PowVal))//如果没有开机,按下的不是power则返回   
        return;   
           
     switch(KeyPrevious)   
      {   
       case KEYPOWER:    
                      KeyPower_Process();   
                      break;   
       case KEYSET:     
                      KeySet_Process();   
                      break;   
       case KEYVOLINC: //UP    
                      KeyVolInc_Process();   
                      break;   
       case KEYVOLDEC://DOWN   
                      KeyVolDec_Process();            
                      break;   
       case KEYPREV:  //LEFT   
                      KeyPrev_Process();   
                      break;   
       case KEYNEXT:  //RIGHT   
                      KeyNext_Process();   
                      break;   
       default:break;   
      }   
    }   
   else   
      SendDataToBus(CMD_KEY,KeyPrevious,KeyLongFlagVal);//SendKeyToBus();    
   if(KeyPrevious==KEYPOWER)   
      KeyPrevious=NOKEY;   
}   
   
void Remo_Process(void)   
{   
   Send_Char(RedCmd);   
   if(!ConnectVal)//if not connect mainboard   
   {   
     if((RedCmd!=REMOPOWER)&&(!PowVal))//如果没有开机,按下的不是power则返回   
        return;   
           
     switch(RedCmd)   
      {   
       case REMOPOWER:    
                      KeyPower_Process();   
                      break;   
       case REMOSET:     
                      KeySet_Process();   
                      break;   
       case REMOUP:   //UP    
                      KeyVolInc_Process();   
                      break;   
       case REMODOWN://DOWN   
                      KeyVolDec_Process();            
                      break;   
       case REMOLEFT:  //LEFT   
                      KeyPrev_Process();   
                      break;   
       case REMORIGHT:  //RIGHT   
                      KeyNext_Process();   
                      break;   
       default:break;   
      }   
    }   
   else   
      SendDataToBus(CMD_REMO,RedCmd,RedLong);//SendKeyToBus();    
}   
   
void ConnectCheck(void)   
{   
   IEBus_TBroadcast=0x00;   
   IEBus_THAddr=0x1FF>>4;   
   IEBus_TLAddr=(uchar)(0x1FF<<4);      
   IEBus_TLength=2;   
   IEBus_TData0=CMD_INIT;//Cmd_KEY   
   IEBus_TData1=0x00;//KEY     
   IEBus_SendData(IEBus_TxBuf);      
}   
   
void Clock_Set(uchar data)   
{   
   uchar c1,c2;   
   c1=data&0xF0;   
   c2=data&0x0F;   
   String_Attrib_Set(STATUSROW,23,6,YELLOW);   
   String_Attrib_Set(STATUSROW+1,20,9,YELLOW);   
   if(c1==0)   
   {    
     RTC_SetTime((SetHour/10*16)+SetHour%10,(SetMinute/10*16)+SetMinute%10);   
     RTC_SetDat((SetYear/10*16)+SetYear%10,(SetMonth/10*16)+SetMonth%10,(SetData/10*16)+SetData%10);   
     INT1_Enable;   
     return;   
   }   
   INT1_Disable;   
   switch(c1)   
   {   
     case 0x10:   
               if(c2==1)   
               {  SetMinute++;   
                   if(SetMinute>59)   
                      SetMinute=0;   
               }   
               else if(c2==2)   
               {                     
                   if(SetMinute==0)   
                      SetMinute=59;   
                   else   
                      SetMinute--;    
               }                    
               Time_Disp((SetHour/10*16)+SetHour%10,(SetMinute/10*16)+SetMinute%10);                    
               String_Attrib_Set(STATUSROW,27,2,YELLOW+0x08);   
               break;   
     case 0x20:   
               if(c2==1)   
               {  SetHour++;   
                   if(SetHour>23)   
                      SetHour=0;   
               }   
               else if(c2==2)   
               {                     
                   if(SetHour==0)   
                      SetHour=23;   
                   else   
                      SetHour--;    
               }     
               Time_Disp((SetHour/10*16)+SetHour%10,(SetMinute/10*16)+SetMinute%10);                  
               String_Attrib_Set(STATUSROW,24,2,YELLOW+0x08);   
               break;   
     case 0x30:   
               if(c2==1)   
               {  SetData++;   
                   if(SetData>31)   
                      SetData=1;   
               }   
               else if(c2==2)   
               {                     
                   if(SetData==1)   
                      SetData=31;   
                   else   
                      SetData--;    
               }     
               Data_Disp((SetYear/10*16)+SetYear%10,(SetMonth/10*16)+SetMonth%10,(SetData/10*16)+SetData%10);   
               String_Attrib_Set(STATUSROW+1,27,2,YELLOW+0x08);   
               break;   
     case 0x40:   
               if(c2==1)   
               {  SetMonth++;   
                   if(SetMonth>12)   
                      SetMonth=1;   
               }   
               else if(c2==2)   
               {                     
                   if(SetMonth==1)   
                      SetMonth=12;   
                   else   
                      SetMonth--;    
               }     
               Data_Disp((SetYear/10*16)+SetYear%10,(SetMonth/10*16)+SetMonth%10,(SetData/10*16)+SetData%10);   
               String_Attrib_Set(STATUSROW+1,24,2,YELLOW+0x08);   
               break;   
     case 0x50:   
               if(c2==1)   
               {  SetYear++;   
                   if(SetYear>99)   
                      SetYear=0;   
               }   
               else if(c2==2)   
               {                     
                   if(SetYear==0)   
                      SetYear=99;   
                   else   
                      SetYear--;    
               }     
               Data_Disp((SetYear/10*16)+SetYear%10,(SetMonth/10*16)+SetMonth%10,(SetData/10*16)+SetData%10);   
               String_Attrib_Set(STATUSROW+1,21,2,YELLOW+0x08);   
               break;   
   }   
}   
   
   
void Cmd_Process(void)   
{   
   uint address;   
   uchar i;   
   address=(IEBus_RxBuf[0]<<4)+(IEBus_RxBuf[1]>>4);   
   
   if(address==IEBus_MASTERADDR)//Masterboard    
    {        
       if(IEBus_RxBuf[3]==0xA0)   
          {}   
       else if((IEBus_RxBuf[3]!=0xA1)&&(IEBus_RxBuf[4]!=0x01)&&(!PowVal))//如果没有开机,按下的不是power则返回   
           return;   
       switch(IEBus_RxBuf[3])   
        {   
          case CMD_INITSET:   
                     switch(IEBus_RxBuf[4])   
                      {   
                        case 0:    
                                if(!ConnectVal)   
                                   ConnectCheck();    
                                else      
                                   SendDataToBus(CMD_CONNECTREQ,StatusFlag&0x80,0x00);   
                                break;   
                        case 1://Video    
                                for(i=0;i<VIDEOMENU_NUM;i++)   
                                     VideoMenu[i]=IEBus_RxBuf[i+5];                                   
                                break;   
                        case 2:   
                                for(i=0;i<SOUNDMENU_NUM;i++)   
                                     SoundMenu[i]=IEBus_RxBuf[i+5];    
                                break;   
                        case 3:   
                                UsrMenu=IEBus_RxBuf[5];   
                                ConnectOk;//当全部的初始值传递之后才表示连接，否则表示连接失败     
                                break;   
                        case 4:   
                        case 5:   
                        case 6:     
                                for(i=0;i<8;i++)   
                                     FreqTab[IEBus_RxBuf[4]-4][i]=IEBus_RxBuf[i+5];   
                                break;                        
                       }   
                        
                     break;   
          case CMD_SYSTEMSET://system setting    
                     switch(IEBus_RxBuf[4])   
                        {   
                           case 0: if(IEBus_RxBuf[5]==0x01)   
                                     {  SysOn_Init(); PowOn; }   
                                   else   
                                     { SysOff_Init(); PowOff;}   
                                   break;     
                           case 1: SourceMode=IEBus_RxBuf[5]; Signal_Disp();break;   
                           case 2: SoundVolume=IEBus_RxBuf[5];Volume_Disp();break;    
                           case 3: Windows_Close();break;    
                           case 4:    
                                   if(IEBus_RxBuf[5]==0x01)   
                                     Ch_Disp(1);   
                                   else   
                                     Ch_Disp(0);                                      
                                   break;   
                           case 5: break;   
                           case 6: UsrMenu=IEBus_RxBuf[5];   
                                   break;   
                           case 7: Clock_Set(IEBus_RxBuf[5]);                                      
                                   break;   
                         }   
                     break;   
          case CMD_SOUNDSET://Sound setting   
                     switch(IEBus_RxBuf[4])   
                       {   
                         case 0:    
                                  if(IEBus_RxBuf[5])   
                                      SoundSet_Windows();   
                                  else   
                                      Windows_Close();                                     
                                  break;   
                         case 1:    
                         case 2:   
                         case 3:    
                         case 4: SoundMenuCnt=IEBus_RxBuf[4]-1;   
                                 SoundMenu[SoundMenuCnt]=IEBus_RxBuf[5];   
                                 Sounddata_Updata();   
                                 break;   
                         default:break;   
                        }                        
                     break;   
          case CMD_VIDEOSET://video setting                        
                     switch(IEBus_RxBuf[4])   
                       {   
                         case 0:    
                                  if(IEBus_RxBuf[5])   
                                  {   
                                    VideoSet_Windows();   
                                    //WindowDispFlag=VIDEO_WINDOW;   
                                   }   
                                  else   
                                  {   
                                    Windows_Close();   
                                    //WindowDispFlag=NO_WINDOW;   
                                   }   
                                  break;   
                         case 1:    
                         case 2:   
                         case 3:    
                         case 4:    
                         case 5:   
                                 VideoMenuCnt=IEBus_RxBuf[4]-1;   
                                 VideoMenu[VideoMenuCnt]=IEBus_RxBuf[5];   
                                 Videodata_Updata();   
                                 Ctr_Process();   
                                 break;   
                         default:break;   
                        }        
                     break;   
          case CMD_RADIOSET://radio setting                        
                     RadioBand=IEBus_RxBuf[4];   
                     RadioFreCH=IEBus_RxBuf[5];   
                     RadioFreq=IEBus_RxBuf[6];                        
                     Radiodata_Updata();   
                     break;   
          case CMD_DVDSET:    
                        
                     DvdData_Updata(IEBus_RxBuf[4],IEBus_RxBuf[5],   
                                    IEBus_RxBuf[6],IEBus_RxBuf[7],IEBus_RxBuf[8]);   
                     break;   
          case CMD_USRSET://USE SETTING   
                     switch(IEBus_RxBuf[4])   
                     {   
                       case 0:     
                                 if(IEBus_RxBuf[5])   
                                   {   
                                    UsrSet_Windows();   
                                    //WindowDispFlag=USR_WINDOW;   
                                    }   
                                 else   
                                  {   
                                    Windows_Close();   
                                    //WindowDispFlag=NO_WINDOW;   
                                   }   
                                 break;   
                        case 1:     
                                 UsrMenuCnt=IEBus_RxBuf[4]-1;   
                                 if((IEBus_RxBuf[5]&0x01)==0x01)   
                                    UsrMenu|=0x01;   
                                 else   
                                    UsrMenu&=0xFE;   
                                 Usrdata_Updata();   
                                 break;   
                        case 2:      
                                 UsrMenuCnt=IEBus_RxBuf[4]-1;   
                                 if((IEBus_RxBuf[5]&0x02)==0x02)   
                                    UsrMenu|=0x02;   
                                 else   
                                    UsrMenu&=0xFD;   
                                 Usrdata_Updata();   
                                 break;   
                        case 3:      
                                 UsrMenuCnt=IEBus_RxBuf[4]-1;   
                                 if((IEBus_RxBuf[5]&0x04)==0x04)   
                                    UsrMenu|=0x04;   
                                 else   
                                    UsrMenu&=0xFB;   
                                 Usrdata_Updata();   
                                 break;   
                        case 4:      
                                 UsrMenuCnt=IEBus_RxBuf[4]-1;   
                                 if((IEBus_RxBuf[5]&0x08)==0x08)   
                                    UsrMenu|=0x08;   
                                 else   
                                    UsrMenu&=0xF7;   
                                 Usrdata_Updata();   
                                 break;            
                      }       
                     break;   
          case 0xA7:   
                     break;   
          case 0xA8:   
                     break;   
          default:   
                     break;   
         }   
          
     }   
   else if(address==IEBus_DVCADDR)//DVC 方式   
   {   
        if((SourceMode!=SourceDvc)||(!PowVal))   
          return;   
        switch(IEBus_RxBuf[3])   
        {   
           case Dvc_Func_Time://Disp Play Time   
                            DvcData_Updata(IEBus_RxBuf[4],IEBus_RxBuf[5],   
                                           IEBus_RxBuf[6],IEBus_RxBuf[7],   
                                           IEBus_RxBuf[8],IEBus_RxBuf[9]);   
                            break;   
        }   
    }   